import java.io.File;
import java.util.Random;

import static java.lang.Thread.*;

public class Test {
    private static class MyThread extends Thread {
        @Override
        public void run() {
            Random random = new Random();
            while (true) {
                System.out.println(currentThread().getName());
                try {
                    sleep(random.nextInt(10));
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }

    public static void main(String[] args) {
        File file = new File("..\\heelo-world.txt");

        System.out.println(file.getParent());
        System.out.println(file.getPath());
        System.out.println(file.getName());
        System.out.println(file.getAbsoluteFile());


    }

    public static void main1(String[] args) {
        // 创建并启动线程
        MyThread thread1 = new MyThread();
        thread1.start();

        Random random = new Random();
        while(true) {
            System.out.println(Thread.currentThread().getName());
            try {
                Thread.sleep(random.nextInt(10));
            }catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}